person = {'name': 'tom', 'age': 18, 'school': 'ustc'}

# 重点：1  4

# 1
for p in person:  # for in 遍历的是key
    print(p, end=' ')
print()
for p in person:
    print(p, '=', person[p], sep='', end=' ')
print()

# 2 利用keys()方法
for k in person.keys():
    print(person[k], end=' ')
print()

# 3 values()方法，不怎么用
# 因为只能拿到value，拿不到key
for va in person.values():
    print(va, end=' ')
print()

# 4
print(person.items())  # 1
for tr in person.items():  # 2
    print(tr, end='')
print()
for tr in person.items():  # 3
    print(tr[0], '=', tr[1], sep='', end=' ')
print()
for k, v in person.items():  # 4
    print(k, '=', v, sep='', end=' ')
print()
